#ifndef TABLESELECTORWIDGET_H
#define TABLESELECTORWIDGET_H

#include <QWidget>
#include <QPaintEvent>

class TableSelectorWidget : public QWidget
{
    Q_OBJECT
public:
    explicit TableSelectorWidget(QWidget *parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event) override;       /** 自绘控件 */
    void mouseMoveEvent(QMouseEvent *event) override;   /** 鼠标移动事件 */
    void mousePressEvent(QMouseEvent *event) override;  /** 鼠标按下事件 */
    void leaveEvent(QEvent *event) override;            /** 鼠标移出事件 */

signals:
    void hoverPosition(int row, int col);
    void selectPosition(int row, int col);
private:
    int m_rows;
    int m_cols;
    int m_hoverRows;
    int m_hoverCols;
    int m_boxWidth;
    int m_boxHeight;
    int m_boxGap;
};

#endif // TABLESELECTORWIDGET_H
